package com.liming.service;

import com.liming.dao.UserInfodao;
import com.liming.dao.Userdao;
import com.liming.model.User;
import com.liming.utils.Md5Utils;

public class UserInfoService {
	UserInfodao infodao=new UserInfodao();
	Userdao userdao=new Userdao();
	public User getUserInfo(String username) {
		User user=infodao.getInfo(username);
			return user;
	}
	//修改用户名
	public boolean changeUserInfo(User user) {
		if(infodao.changeUserInfo(user)==1) {
			return true;
		}
		return false;
	}
	//修改密码
	public boolean changepassword(String username,String opassword,String npassword) {
		String password=Md5Utils.md5(opassword);
		if(infodao.changePassword(username, password, npassword)==1) {
			System.out.println("service 修改密码成功");
			return true;
		}
		
		return false;
	}
	public boolean isFindAccount(String username,String password) {
		String apassword=Md5Utils.md5(password);
		if(userdao.findUser(username,apassword)!=null) {
			return true;
		}
		return false;
	}
}
